package com.kangfu.api.controller;

import com.kangfu.api.interceptor.AuthorizationInterceptor;
import com.kangfu.api.service.IQuestionnaireService;
import com.kangfu.common.model.AjaxResult;
import com.kangfu.db.model.vo.QuestionnaireVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/questionnaire")
public class QuestionnaireController {

    @Autowired
    public IQuestionnaireService questionnaireService;

    @GetMapping("/list")
    public AjaxResult getQuestionnaireList(@RequestAttribute(AuthorizationInterceptor.LOGIN_USER_ID) int userId, @RequestParam(name = "page", defaultValue = "1") int page) {
        List<QuestionnaireVo> list = questionnaireService.getQuestionnaireList(userId, page);

        return AjaxResult.success(list);
    }
}
